

package com.wwy.monitor.service.acl;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @Author:yangxu
 * @Descripton:
 * @Date: Created in 11:17 2019/4/9
 */
@Service
public class AclUrlCheckService {
    @Value("${spring.acl.regular}")
    private String aclUrlPatternString;
    private Pattern mPattern;

    @PostConstruct
    private void init() {
        mPattern = Pattern.compile(aclUrlPatternString);
    }

    /**
     * æ£æ¥æ¯å¦ç¬¦åç½åå
     *
     * @param pathName
     * @return
     */
    public boolean checkByAclWhiteList(String pathName) {
        Matcher matcher = mPattern.matcher(pathName);
        return matcher.matches();
    }
}